package com.cp.weixin.blog.controller;

import com.cp.weixin.blog.service.CategoryService;
import com.cp.weixin.blog.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;

@Controller
public class BaseController {

    @Autowired
    TagService tagService;

    @Autowired
    CategoryService categoryService;


    @ModelAttribute
    public void addAttributes(Model model) {
        model.addAttribute("categoryList", categoryService.getAll());
        model.addAttribute("tagList", tagService.getAll());
    }


}
